Fix plugin compatibility with Prettier v3.7+#418
Merged
thecrypticace merged 10 commits intomainfrom Dec 1, 2025
Merged
Conversation
Some older/outdated plugins don’t work with Prettier v3.7
|
Nice. Current solution until this gets released: "prettier-plugin-tailwindcss": "git://github.com:tailwindlabs/prettier-plugin-tailwindcss#ab900fa3ecdca78a2e19647336c503f9bf45e741",
|
|
I spend sometime to debug, seem the root cause is here prettier-plugin-tailwindcss/src/index.ts Line 53 in dd02e91 |
It’s unncessary and causes an incompatibility with Prettier v3.7+ Most likely a left over from when we *also* supported Prettier v2.
That plugin is currently broken when used with Prettier v3.7
0646490 to
b5b2531
Compare
fisker
reviewed
Dec 1, 2025
|
|
||
| // @ts-ignore | ||
| return base.printers['svelte-ast'].embed(path, options) | ||
| } |
There was a problem hiding this comment.
Should we consider use a proxy here?
const embed = new Proxy(base.printers['svelte-ast'].embed, {
apply(target, thisArgument, argumentsList) {
const [path, options] = argumentsList;
mutateOriginalText(path, options)
return Reflect.apply(target, thisArgument, argumentsList)
}
})just incase svelte add visitorKeys for embed in future.
Contributor
Author
There was a problem hiding this comment.
Oooh yeah, that's a good idea. Thanks!
Contributor
Author
There was a problem hiding this comment.
Do you think it's worth doing the same for print as well?
There was a problem hiding this comment.
Yes, but currently Prettier doesn't support additional keys on it. So up to you.
It’s not strictly necessary gonna do this for consistency
RobinMalfait
approved these changes
Dec 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a work in progress.
Fixes #417
Notes:
For some reasonFixed. We should not (nor do we need to) overrideembed.getVisitorKeysis being called when using the Svelte plugin — but I'm pretty sure it's supposed to be optional. I don't know why bumping Prettier has caused this to happen. My temporary patch that seems to fix it is to always define it and delegate to printer.getVisitorKeys but that definitely doesn't feel right. Need to figure out why it's being called in the first place.options.printer.Some older versions of some prettier plugins we were testing against aren't compatible with v3.7. Updating them has fixed that issue though.
The current version (v4.0.3) of
prettier-plugin-multiline-arraysis broken with Prettier v3.7+ on its own so those tests are going to fail — not related to our plugin at all:Reproductions for that issue: